package com.lz.fruitday.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.lz.fruitday.R;
import com.lz.fruitday.bean.RotationBean;
import com.lz.fruitday.utils.ImageLoaderUtil;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by liuZhi
 * 2015/10/21
 */
public class HomeLvAdapter extends AppBaseAdapter<RotationBean> {
    private final DisplayImageOptions options;
    public HomeLvAdapter(List<RotationBean> list, Context context) {
        super(list, context);
        options= ImageLoaderUtil.getDefaultOptions();
    }

    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        ViewHolder vh=ViewHolder.get(context,convertView,parent, R.layout.item_home_listview_layout);
        ImageView ivPhoto= (ImageView) vh.findViewById(R.id.iv_banner_photo);
        ImageLoader.getInstance().displayImage(list.get(position).getPhoto(),ivPhoto,options);
        return vh;
    }
}
